package 如何初始化数组;

public class 数组反转10 {
	public static void main(String[] args) {
		 
        double[] a = new double[5];
 
        a[0] = Math.random() * 100;
        a[1] = Math.random() * 100;
        a[2] = Math.random() * 100;
        a[3] = Math.random() * 100;
        a[4] = Math.random() * 100;
 
        System.out.println("原数组是：");
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
 
        System.out.println("数组反转之后：");
        double tem = 0;
        for (int i = 0; i < (a.length-1)/2; i++) {
            tem = a[i];
            a[i]= a[a.length -1 - i];
            a[a.length -1 -i] = tem;
        }
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
 
    }
}
